The Go Programming Language

Package sort

import "doc_example"

Sorting using a general interface:

Package files

sort.go

func Float64sAreSorted

func Float64sAreSorted(a []float64) bool

func IntsAreSorted

func IntsAreSorted(a []int) bool

func IsSorted

func IsSorted(data Interface) bool

Test if data is sorted

func Sort

func Sort(data Interface)

General sort function

func SortFloat64s

func SortFloat64s(a []float64)

func SortInts

func SortInts(a []int)

Convenience wrappers for common cases

func SortStrings

func SortStrings(a []string)

func StringsAreSorted

func StringsAreSorted(a []string) bool

type Float64Array

type Float64Array []float64

func (Float64Array) Len

func (p Float64Array) Len() int

func (Float64Array) Less

func (p Float64Array) Less(i, j int) bool

func (Float64Array) Swap

func (p Float64Array) Swap(i, j int)

type IntArray

Convenience types for common cases: IntArray

type IntArray []int

func (IntArray) Len

func (p IntArray) Len() int

func (IntArray) Less

func (p IntArray) Less(i, j int) bool

func (IntArray) Swap

func (p IntArray) Swap(i, j int)

type Interface

Sorting interface

type Interface interface {
    Len() int
    Less(i, j int) bool
    Swap(i, j int)
}

type StringArray

type StringArray []string

func (StringArray) Len

func (p StringArray) Len() int

func (StringArray) Less

func (p StringArray) Less(i, j int) bool

func (StringArray) Swap

func (p StringArray) Swap(i, j int)

Other packages

main

Build version release.r58 8731. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.